<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="common.jsp" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>角色列表</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	
	<script type="text/javascript">
		function addUserPreview(roleid) {
			window.showModalDialog("role-listUser.action?role.id="+roleid,null,"dialogWidth=580px;dialogHeight=400px");
		}
	</script>
  </head>
  
  <body>
<%@ include file="include.jsp" %>
<center><h3>角色列表</h3><br/></center>

	<permission:find permission="0" userid="${param.userid}" moduleid="${param.moduleid}">
		<a href="role-edit.action" style="float: right">添加角色</a>
	</permission:find>
	<br/><br/>
					
    <!-- 列表数据栏 -->
    <table width="100%" border="0" cellPadding="0" cellSpacing="1" bgcolor="#6386d6">
    <tr bgcolor="#EFF3F7" class="TableBody1">
		<td width="25%" height="37" align="center"><b>序号</b></td>
		<td width="30%" height="37" align="center"><B>角色名称</B></td>
		<td width="45%" height="37" align="center"><B>操作</B></td>
    </tr>
    <c:if test="${!empty pm.resultList}">
		<c:forEach items="${pm.resultList}" var="info">
	    	<tr bgcolor="#EFF3F7" onmouseover="this.bgColor = '#DEE7FF';" onmouseout="this.bgColor='#EFF3F7';">
		    	<td align="center" vAlign="center">${info.id }</td>
				<td align="center" vAlign="center"><a href="role-find.action?role.id=${info.id}">${info.name }</a></td>
				<td align="center" vAlign="center">
					
					<permission:find permission="2" userid="${param.userid}" moduleid="${param.moduleid}">
						<a href="role-find.action?role.id=${info.id}">编辑</a>
					</permission:find>
					<permission:find permission="7" userid="${param.userid}" moduleid="${param.moduleid}">
						<a href="module-listPermission.action?role.id=${info.id}" target="_blank">授权</a>
					</permission:find>
					<permission:find permission="3" userid="${param.userid}" moduleid="${param.moduleid}">
						<a href="role-delete.action?role.id=${info.id}" onclick="return confirm('确定删除吗？');">删除</a>
					</permission:find>
					<permission:find permission="4" userid="${param.userid}" moduleid="${param.moduleid}">
						<a href="javascript:addUserPreview(${info.id})">添加用户</a>
					</permission:find>
					
					<!-- 
					<a href="role-edit.action">添加2</a>
					<a href="role-find.action?role.id=${info.id}">编辑2</a>
					<a href="module-listPermission.action?role.id=${info.id}" target="_blank">授权2</a>
					<a href="role-delete.action?role.id=${info.id}" onclick="return confirm('确定删除吗？');">删除2</a>
					<a href="javascript:addUserPreview(${info.id})">添加用户</a>
					 -->
				</td>
        	</tr>
        </c:forEach>
	</c:if>
	<c:if test="${empty pm.resultList}">
		<tr>
			<td>
	    		没有找到相应的记录
			</td>
		</tr>
	</c:if>
	</table>
	<TABLE width="100%" border=0 align=center cellPadding=0 cellSpacing=0 borderColor=#ffffff style="FONT-SIZE: 10pt">
        <TBODY>
          <TR>
            <TD height=28 align=right vAlign=center noWrap background=images/list_middle.jpg>&nbsp;&nbsp;
            <!-- 可以在这里插入分页导航条 -->
            <pg:pager url="role-list.action" maxPageItems="2" maxIndexPages="10" items="${pm.recordSum }" export="currentPageNumber=pageNumber">
				<pg:param name="userid"/>
				<pg:param name="moduleid"/>
				<pg:first>
					<a href="${pageUrl}">首页</a>
				</pg:first>
				<pg:prev>
					<a href="${pageUrl}">前页</a>
				</pg:prev>
				<pg:pages>
					<c:choose>
						<c:when test="${currentPageNumber eq pageNumber}">
							<font color="red">${pageNumber }</font>
						</c:when>
						<c:otherwise>
							<a href="${pageUrl}">${pageNumber }</a>
						</c:otherwise>
					</c:choose>
				</pg:pages>
				<pg:next>
					<a href="${pageUrl}">下页</a>
				</pg:next>
				<pg:last>
					<a href="${pageUrl}">尾页</a>
				</pg:last>
			</pg:pager>
    		</TD>
          </TR>
        </TBODY>
      </TABLE>
  </body>
</html>
